<include file="Public:head" title='用户详情' />
<script src="__PUBLIC__/js/Jquery/validate.js"></script>
<script type="text/javascript">
    $(function(){
//        checkFengting();
        var id = '{$detail.id}';
        var id_url = '';
        if(id>0){
            id_url = "/id/"+id+"";
        }
        var mobile = $('#mobile').val();
        jQuery.validator.addMethod("isMobile", function(value, element) {  
            var length = value.length;        
            var mobile=/^1[3,5,8]\d{9}$/;
            return (length == 11 && mobile.exec(value))? true:false;  
        }, "请正确填写您的手机号码"); 
        $("#form").validate({
            errorPlacement: function(error, element){
                var error_td = element.parent('td');
                error_td.find('label.error').hide();
                error_td.append(error);
            },
            rules : {
                name : {
                    required : true,
                    minlength: 3,
                    maxlength: 15,
                    remote   : {
                        url :'__APP__/{$Think.MODULE_NAME}/Ajax/check_name'+id_url,
                        type:'post',
                        data:{
                            name : function(){
                                return $('#name').val();
                            }
                        }
                    }
                },
                pwd : {
                    minlength: 6,
                    maxlength: 20
                },
                email : {
                    email    : true,
                    remote   : {
                        url : '__APP__/{$Think.MODULE_NAME}/Ajax/check_email'+id_url,
                        type: 'post',
                        data:{
                            email : function(){
                                return $('#email').val();
                            }
                        }
                    }
                },
                phone : {
                    isMobile  : true,
                    remote   : {
                        url : '__APP__/{$Think.MODULE_NAME}/Ajax/check_mobile'+id_url,
                        type: 'post',
                        data:{
                            phone : function(){
                                return $('#phone').val();
                            }
                        }
                    }
                }
                
            },
            messages : {
                name : {
                    required : '用户名不能为空',
                    minlength:  '用户名必须在3-15个字符之间',
                    maxlength : '用户名必须在3-15个字符之间',
                    remote	 : '该用户名已经存在'
                },
                pwd  : {
                    minlength: '密码长度应在6-20个字符之间',
                    maxlength: '密码长度应在6-20个字符之间'
                },
                email : {
                    email    : '这不是一个有效的电子邮箱',
                    remote	 : '该电子邮箱已经存在'
                },
                phone : {
                    isMobile: "请输入有效的手机号码",
                    remote	 : '该手机号码已经存在'
                }
                
            }
        });
    });
    function checkFengting(){
        var check = $("input[name=state]:checked").val();
        if(check == 0){
            $('#fengting').hide();
        }else{
            $('#fengting').show();
        }
    }
</script>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a href="{:U('User/lists')}">用户管理</a></li>
                    <li class="active">用户{$Think.get.id|getPageType}</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">
                                <h3 class="header smaller lighter blue">用户{$Think.get.id|getPageType}</h3>

                                <form action="{:U('User/detail_post')}" method="POST" id="form">
                                    <table class="table table_detail">
                                        <tbody>
                                            <tr>
                                    <td class="td_left">用户名:</td>
                                    <td>
                                        <input class="common_txt" type="text" value="{$detail.name}" name="name" id="name" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_left">密码:</td>
                                    <td>
                                        <input class="common_txt" type="text" value="" name="pwd" id="pwd" />
                                    </td>
                                </tr>
                            <tr>
                                <td class="td_left">手机号:</td>
                                <td>
                                    <input class="common_txt" type="text" value="{$detail.phone}" name="phone"id="phone" />
                                </td>
                            </tr>
                            <tr>
                                <td class="td_left">email:</td>
                                <td>
                                    <input class="common_txt" type="text" value="{$detail.email}" name="email" id="email"/>
                                </td>
                            </tr>

                            <if  condition="$detail.id gt 0">
                                <tr>
                                    <td class="td_left">注册时间:</td>
                                    <td>
                                        {$detail.addtime|date="Y-m-d H:i",###}
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_left">最后登录时间:</td>
                                    <td>
                                        {$detail.logintime|date="Y-m-d H:i",###}
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_left">最后登录ip:</td>
                                    <td>
                                        {$detail.loginip}
                                    </td>
                                </tr>
<!--                                <tr>
                                    <td class="td_left">是否封停:</td>
                                    <td>
                                        <input type="radio" name="state" value="0"onclick="checkFengting()" autocomplete="off" 
                                <if condition="$detail.state eq 0">checked</if>> 否
                                <input type="radio" name="state" value="1" onclick="checkFengting()" autocomplete="off" 
                                       <if condition="$detail.state eq 1">checked</if>> 是
                                </td>
                                </tr>
                                <tr id="fengting" style="display: none">
                                    <td class="td_left">封停原因:</td>
                                    <td>
                                        <textarea style="width:410px;height:50px;" name="reason">{$log.reason}</textarea>
                                    </td>
                                </tr>-->
                            </if>
                                            <tr>
                                                <td class="td_left"></td>
                                                <td>
                                                    <input type='hidden' name='id' value='{$Think.get.id}'/>
                                   
                                            <button class="btn btn-info btn-sm" type="submit">
                                                <i class="icon-ok bigger-110 "></i>
                                                保 存
                                            </button>

                                        <button class="btn btn-sm reset" type="button" onclick="goUrl(-1)">
                                            <i class="icon-undo bigger-110"></i>
                                            返 回
                                        </button>
                                        </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public:setting" />
    </div>
</div>
<include file="Public:foot" />